3.1.57 \(\int \frac {\cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx\) [57]

Optimal. Leaf size=29 \[ \frac {\tanh ^{-1}(\cos (c+d x))}{a d}-\frac {\cot (c+d x)}{a d} \]

[Out]

arctanh(cos(d*x+c))/a/d-cot(d*x+c)/a/d

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {2785, 3852, 8, 3855} \begin {gather*} \frac {\tanh ^{-1}(\cos (c+d x))}{a d}-\frac {\cot (c+d x)}{a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^2/(a + a*Sin[c + d*x]),x]

[Out]

ArcTanh[Cos[c + d*x]]/(a*d) - Cot[c + d*x]/(a*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2785

Int[((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/a, Int[S
ec[e + f*x]^2*(g*Tan[e + f*x])^p, x], x] - Dist[1/(b*g), Int[Sec[e + f*x]*(g*Tan[e + f*x])^(p + 1), x], x] /;
FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && NeQ[p, -1]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \frac {\cot ^2(c+d x)}{a+a \sin (c+d x)} \, dx &=-\frac {\int \csc (c+d x) \, dx}{a}+\frac {\int \csc ^2(c+d x) \, dx}{a}\\ &=\frac {\tanh ^{-1}(\cos (c+d x))}{a d}-\frac {\text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{a d}\\ &=\frac {\tanh ^{-1}(\cos (c+d x))}{a d}-\frac {\cot (c+d x)}{a d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(69\) vs. \(2(29)=58\).
time = 0.18, size = 69, normalized size = 2.38 \begin {gather*} -\frac {\csc \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {1}{2} (c+d x)\right ) \left (\cos (c+d x)+\left (-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sin (c+d x)\right )}{2 a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^2/(a + a*Sin[c + d*x]),x]

[Out]

-1/2*(Csc[(c + d*x)/2]*Sec[(c + d*x)/2]*(Cos[c + d*x] + (-Log[Cos[(c + d*x)/2]] + Log[Sin[(c + d*x)/2]])*Sin[c
 + d*x]))/(a*d)

________________________________________________________________________________________

Maple [A]
time = 0.18, size = 44, normalized size = 1.52

method result size
derivativedivides \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {1}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}}{2 d a}\) \(44\)
default \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-2 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {1}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}}{2 d a}\) \(44\)
risch \(-\frac {2 i}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d a}\) \(63\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^2/(a+a*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/2/d/a*(tan(1/2*d*x+1/2*c)-2*ln(tan(1/2*d*x+1/2*c))-1/tan(1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 70 vs. \(2 (29) = 58\).
time = 0.28, size = 70, normalized size = 2.41 \begin {gather*} -\frac {\frac {2 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {\cos \left (d x + c\right ) + 1}{a \sin \left (d x + c\right )} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(2*log(sin(d*x + c)/(cos(d*x + c) + 1))/a + (cos(d*x + c) + 1)/(a*sin(d*x + c)) - sin(d*x + c)/(a*(cos(d*
x + c) + 1)))/d

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 62 vs. \(2 (29) = 58\).
time = 0.35, size = 62, normalized size = 2.14 \begin {gather*} \frac {\log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 2 \, \cos \left (d x + c\right )}{2 \, a d \sin \left (d x + c\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - log(-1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 2*cos(d*x + c))/(a
*d*sin(d*x + c))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {\cot ^{2}{\left (c + d x \right )}}{\sin {\left (c + d x \right )} + 1}\, dx}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**2/(a+a*sin(d*x+c)),x)

[Out]

Integral(cot(c + d*x)**2/(sin(c + d*x) + 1), x)/a

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 65 vs. \(2 (29) = 58\).
time = 10.36, size = 65, normalized size = 2.24 \begin {gather*} -\frac {\frac {2 \, \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a} - \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} - \frac {2 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1}{a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/2*(2*log(abs(tan(1/2*d*x + 1/2*c)))/a - tan(1/2*d*x + 1/2*c)/a - (2*tan(1/2*d*x + 1/2*c) - 1)/(a*tan(1/2*d*
x + 1/2*c)))/d

________________________________________________________________________________________

Mupad [B]
time = 6.64, size = 25, normalized size = 0.86 \begin {gather*} -\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )+\mathrm {cot}\left (c+d\,x\right )}{a\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^2/(a + a*sin(c + d*x)),x)

[Out]

-(log(tan(c/2 + (d*x)/2)) + cot(c + d*x))/(a*d)

________________________________________________________________________________________